<?php
/**
 * @package WordPress
 * @subpackage LRC-Library_Theme
 */
/*
Template Name: Books List Page
*/
?>
<?php get_header(); ?><?php 
$type = 'books';
$args=array(
  'post_type' => $type,
  'post_status' => 'publish',
  'paged' => $paged,
  'posts_per_page' => 2,
  'caller_get_posts'=> 1
);
$temp = $wp_query;  // assign orginal query to temp variable for later use   
$wp_query = null;
$wp_query = new WP_Query($args); 
?>	<?php if(function_exists('bookSubmit')): ?>	

<?php if (have_posts()) :?><h1>This is Books List</h1> <br /><br />
<table border="5" cellpadding="5" cellspacing="15" width="99%" cols="6" id="booklist" class="booklist">
<tr border="1" id="booklist" class="booklist"><td><h3>List ID:</h3></td><td><h3>Title:</h3></td><td><h3>Authors</h3></td><td><h3>Cat</h3></td><td><h3>Tags</h3></td><td><h3>listed Date</h3></td></tr>
<?php 
	     $args = array(
           'showposts'=>20,
           );	
	  query_posts($args);
	    $x = 1;
	 ?>

<?php while (have_posts()) : the_post(); 		$custom = get_post_custom($post->ID);
		$thumb = $custom['book-thumb'][0];
		$bookid= $custom['bookid'][0];
		$authors= $custom['bookauthors'][0]; ?>

<tr><td><a href="<?php the_permalink() ?>" title="<?php printf(__("Permanent Link to %s", "wpbl"), the_title_attribute('echo=0')); ?>"><?php echo $id; ?></a></td>
<td><a href="<?php the_permalink() ?>" title="<?php printf(__("Permanent Link to %s", "wpbl"), the_title_attribute('echo=0')); ?>"><?php the_title(); ?></a></td>
<td><?php get_terms( 'authors' ) ?> </td>
<td>				<?php if ( count( get_the_category() ) ) : ?>	
<?php printf( __( '%1$s'), get_the_category_list( ', ' ) ); ?>
				<?php endif; ?></td>
<td>				<?php
					$tags_list = get_the_tag_list( '', ', ' );
					if ( $tags_list ):
				?>
				<?php printf($tags_list); ?><?php endif; ?></td>
				
				<td><?php  the_time(get_option('date_format')); ?></td>
</tr>
 
<?php endwhile; ?></table><br /><?php else: ?>

<div class="entry">
<p><?php _e('Sorry, no posts matched your criteria.','wpbl'); ?></p>
</div>

<?php endif; ?>
	<?php
    if(function_exists('pagination')) { pagination(); }
    ?><span class="top"><?php
    if(function_exists('pagination')) { pagination(); }
    ?></span>
<br />
<?php else: echo "You did not install or activate <strong>WP Custom Search Plugins.</strong> So you can't view this page."; endif; ?> 

<?php get_footer(); ?>